<template>
  <div>
    <Navbar :appTitle="appTitle" :showScan="showScan" @changeScan="changeScan1" @scanCode="scanCode"
      @ClickRight="ClickRight" @goBack="closeScan" />
    <div class="form-content wrap-apply" style="margin-right: 30px" :style="{
      top: GLOBAL.currentEnvironment ? '0' : '',
      height: GLOBAL.currentEnvironment ? '100vh' : 'calc(100vh - 100px)',
      paddingBottom: GLOBAL.currentEnvironment ? '120px' : '',
    }">
      <van-cell-group>
        <van-cell>
          <template #title>
            <p class="label required FormTit"><span></span>出库单编号</p>
          </template>
          <!-- 使用默认插槽自定义内容 -->
          <template #default>
            <div class="">
              <van-field v-model="buildForm.taskCode" input-align="right" :maxLength="50" placeholder="请输入、不输入则自动生成"
                @blur="checkInputValue(buildForm.taskCode)" />
            </div>
          </template>
        </van-cell>

        <div class="bottomLine"></div>
        <van-cell>
          <template #title>
            <p class="label required FormTit"><span></span>单据日期：</p>
          </template>
          <!-- 使用默认插槽自定义内容 -->
          <template #default>
            <div class="">
              <van-field input-align="right" is-link readonly name="picker" v-model="buildForm.operateTime"
                @click="openTimePicker(i, buildForm.operateTime)" placeholder="请选择" />
            </div>
          </template>
        </van-cell>
        <van-cell>
          <template #title>
            <p class="label required FormTit"><span></span>业务类型</p>
          </template>
          <!-- 使用默认插槽自定义内容 -->
          <template #default>
            <div class="">
              <van-field-select-picker input-align="right" :supportClear="true" label="" placeholder="请选择"
                v-model="buildForm.operateTaskType" :columns="warehousingTypes"
                :option="{ label: 'text', value: 'value' }" @confirm="(itemReport) => selectReport(itemReport, 'operateTaskType')
                  " />
            </div>
          </template>
        </van-cell>
        <div class="bottomLine"></div>

        <van-cell v-if="
          buildForm.operateTaskType && buildForm.operateTaskType == 'SALE'
        ">
          <template #title>
            <p class="label FormTit"><span></span>客户</p>
          </template>
          <!-- 使用默认插槽自定义内容 -->
          <template #default>
            <div class="">
              <van-field input-align="right" v-model="buildForm.customerName" placeholder="请输入" :maxLength="50" />
            </div>
          </template>
        </van-cell>
        <div class="bottomLine" style="height: 8px"></div>
        <div class="addGoodScontain">
          <div class="addgoods" @click="addInventoryGoods">
            <van-icon name="plus" size="16px" color="#1890ff" style="top: 2px" />
            <a>物品</a>
          </div>
          <div class="addgoods" @click="showLatticeNotification">
            <van-icon name="plus" size="16px" color="#1890ff" style="top: 2px" />
            <a>库位</a>
          </div>
        </div>
        <div class="bottomLine" style="height: 8px"></div>
        <div class="tabs-contain" v-if="goodsDetailsList && goodsDetailsList.length != 0">
          <van-tabs v-model="active" color="#1989fa" title-active-color="black" swipe-threshold="3" line-width="2.4rem">
            <van-tab v-for="(item, index) in goodsDetailsList" :key="index" :title="item.goodsName"
              :name="item.goodsKey" title-class="tab-wrap-ano">
              <div class="bottomLine"></div>
              <div class="list">
                <div class="wrap">
                  <div class="pd">
                    <div class="top">
                      <div class="title titleWidth" style="margin: 0">
                        {{ item.goodsCode }} | {{ item.goodsName }} |
                        {{ item.spec }}
                      </div>
                    </div>
                    <div class="center">
                      <div>
                        <div class="title">
                          <span class="key">包装规格：</span>
                          <span class="value">{{
                            item.packageSpec || "-"
                          }}</span>
                        </div>
                        <div class="title">
                          <span class="key">产地：</span>
                          <span class="value">{{ item.address || "-" }}</span>
                        </div>
                      </div>
                    </div>
                    <div class="label">
                      <span>{{ item.produceDate || "-" }}</span>
                      <span>{{ item.batchCode || "-" }}</span>
                      <span>{{ item.unitName || item.unitIdText || "-" }}</span>
                    </div>
                  </div>
                  <div class="gap"></div>

                  <div class="list">
                    <div class="wrap" v-for="(p, i) in item.itemList" :key="p.latticeId"
                      v-show="item.itemList.length != 0">
                      <van-cell-group>
                        <p class="label otherText" style="display: flex; justify-content: space-between">
                          库位({{ i + 1 }})
                          <span style="
                              font-weight: 400;
                              color: #ff4d4f;
                              font-size: 15px;
                              background: #fff;
                            " @click="deleteGoodsLattice(index, i)">删除
                          </span>
                        </p>
                        <div class="bottomLine"></div>
                        <van-field label="出库库位" required readonly input-align="right" :maxLength="21">
                          <template slot="right-icon" v-if="!p.latticeName">
                            <div @click="selectKw(p)">请选择或扫码</div>
                          </template>
                          <template slot="right-icon" v-if="p.latticeName">
                            <div style="
                                color: #333;
                                display: flex;
                                align-items: center;
                              " @click="showLatticeNotificatios(index)">
                              <div style="
                                  white-space: nowrap;
                                  text-overflow: ellipsis;
                                  overflow: hidden;
                                  width: 200px;
                                ">
                                {{ p.latticeCode || "-" }} | {{ p.latticeName }}
                              </div>
                              <van-icon name="arrow" color="#999" />
                            </div>
                          </template>
                          <template slot="button">
                            <div @click="toggleCode('kw1', p)">
                              <scanInputOutTask ref="scanInputOutTask" @changeScan="changeScan" @goBack="closeScan" />
                            </div>
                          </template>
                        </van-field>
                        <div class="bottomLine"></div>
                        <van-field label="出库数量" required input-align="right" v-model="p.outboundQuantity"
                          :maxLength="21" placeholder="请输入" :formatter="(e) => newClearNoNum(e, p.totalNum)" />
                      </van-cell-group>
                      <div style="height: 1px; background-color: #f3f3f3"></div>
                    </div>
                    <div class="addGoodScontain">
                      <div class="addgoods" @click="showLatticeNotificatios(index)">
                        <van-icon name="plus" size="16px" color="#1890ff" style="top: 2px" />
                        <a>库位</a>
                      </div>
                      <div class="addgoods" @click="clickCode(index, null, true)">
                        <!--                        <scanInputGoods-->
                        <!--                            ref="scanGoodsInput"-->
                        <!--                            @changeScan="changeScan"-->
                        <!--                        />-->
                        <van-icon name="scan" size="16px" color="#1890ff" style="top: 2px" />
                        <a>扫库位码</a>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </van-tab>
          </van-tabs>
          <div class="all-down-btn" v-show="goodsDetailsList.length > 3">
            <p @click="openDropDownModel">
              <span>全部</span>
              <span>
                <van-icon name="arrow-down" color="#1989fa" size="16" />
              </span>
            </p>
          </div>
          <div class="all-down-model" v-show="allDownShow">
            <div class="tags-contain">
              <span class="goodsNameTag" v-for="(item, index) in goodsDetailsList" :key="index"
                @click="clickGoodsNames(item)" :style="{
                  color: item.goodsKey == active ? '#1890ff' : '#333333',
                }">
                {{ item.goodsName }}
              </span>
            </div>
            <div class="ctrBtn-contian">
              <span @click="closeDropDownModel">收起</span>
              <span>
                <van-icon name="arrow-up" color="#1989fa" size="16" />
              </span>
            </div>
          </div>
        </div>

        <van-empty v-else description="物品明细为空" />
      </van-cell-group>
      <!--      v-if="!columnsData.listShow&&!showSubBtn"-->
      <div class="search-bottoms">
        <van-button :loading="subLoading" loading-text="提交中..." class="btnconfirm" @click="btnConfirm">提交</van-button>
      </div>
    </div>

    <!--选择出库日期 -->
    <van-popup v-model="timePickShow" position="bottom">
      <van-datetime-picker @confirm="confirmPick" v-model="happenTime" @cancel="cancelPick" type="date" title="生产日期"
        :formatter="formatter" />
    </van-popup>
    <!--选择物品 -->
    <goods-pickers v-if="showGoodsPicker" :cusStyle="cusStyle" :listUrl="listUrl" :checkedShow="false"
      :columns="goodsColumns" :selectedGoods="goodsDetailsList" @getCheckedGoods="getCheckedGoods"
      @handleList="handleList"></goods-pickers>

    <!-- 库位选择 -->
    <binLocation-pickers-ak v-if="isShowLatticeNotification" :selectedGoods="entryDetails"
      @getCheckedValue="getCheckedValue" :columns="latticeNotificationgColumns" :listUrl="latticeNotificationUrl"
      @handleList="getCheckedValueList"></binLocation-pickers-ak>

    <!-- 出库物品库位选择：根据物品选择库位-->
    <select-list v-if="columnsData.listShow" :columnsData="columnsData" :selectLattice="selectLattice" ref="selectList"
      @getCheckedValue="getCheckedValuess" @handleList="getCheckedValue" @listData="listData" @goBack="closeGoodsKwPop">
      <div slot="head" class="selectList" slot-scope="{ item, index }">
        <van-cell-group>
          <div class="list">
            <div class="wrap">
              <div class="">
                <div class="top">
                  <div class="icon" v-if="!columnsData.checkedShow"></div>
                  <div class="title titleWidth" v-if="isSelectAll || selectLattice">
                    {{ item.latticeCode }} | {{ item.latticeName }}
                  </div>
                  <div class="title" v-else>
                    {{ item.goodsCode || "-" }} | {{ item.goodsName || "-" }}
                  </div>
                </div>
                <div class="center" v-if="columnsData.checkedShow && isSelectAll && !selectLattice">
                  <div>
                    <van-field label="库存数量：" label-width="80" readonly input-align="right" :value="item.goodsNum"
                      placeholder="请输入">
                      <template #right-icon>
                        <span>{{
                          columnsData.query.unitName ||
                          columnsData.query.unitIdText ||
                          "-"
                        }}</span>
                      </template>
                    </van-field>
                    <van-field label="出库数量" required type="number" input-align="right" v-model="item.outboundQuantity"
                      placeholder="请输入" :formatter="(e) => newClearNoNum(e, item.goodsNum)">
                      <template #right-icon>
                        <span>{{
                          columnsData.query.unitName ||
                          columnsData.query.unitIdText ||
                          "-"
                        }}</span>
                      </template>
                    </van-field>
                  </div>
                </div>

                <!-- 根据物品查库位的显示 -->
                <!-- {{ item }} -->
                <div class="center my-style" v-if="selectLattice">
                  <div>
                    <van-field label="库存数量：" label-width="80" readonly input-align="right" :value="item.goodsNum"
                      placeholder="请输入">
                      <template #right-icon>
                        <span>{{
                          columnsData.query.unitName ||
                          columnsData.query.unitIdText ||
                          "-"
                        }}</span>
                      </template>
                    </van-field>
                    <van-field label="出库数量" required type="number" input-align="right" v-model="item.outboundQuantity"
                      placeholder="请输入" :formatter="(e) => newClearNoNum(e, item.goodsNum)"
                      @change="changeQuantity(item)">
                      <template #right-icon>
                        <span>{{
                          item.unitName || item.unitIdText || "-"
                        }}</span>
                      </template>
                    </van-field>
                  </div>
                </div>

                <div class="center my-style" v-if="
                  columnsData.checkedShow && !isSelectAll && !selectLattice
                ">
                  <div>
                    <div style="margin-top: 5px">
                      产地：{{ item.address || "-" }}
                    </div>
                    <div style="margin-top: 5px">
                      包装规格：{{ item.packageSpec || "-" }}
                    </div>
                    <div class="label" style="
                        padding: 0;
                        display: flex;
                        justify-content: space-between;
                        margin-top: 10px;
                      ">
                      <div>
                        <span>{{ item.produceDate || "-" }}</span>
                        <span>{{ item.batchCode || "-" }}</span>
                        <span>{{ item.totalNum || "-" }}</span>
                      </div>
                    </div>
                    <van-field label="出库数量" required type="number" input-align="right" v-model="item.outboundQuantity"
                      placeholder="请输入" :formatter="(e) => newClearNoNum(e, item.totalNums)">
                      <template #right-icon>
                        <span>{{
                          item.unitName || item.unitIdText || "-"
                        }}</span>
                      </template>
                    </van-field>
                  </div>
                </div>

                <div class="center" v-else-if="!columnsData.checkedShow && isSelectAll">
                  <div style="margin-top: 5px">
                    库位库存：{{ item.goodsNum
                    }}{{
                      columnsData.query.unitName ||
                      columnsData.query.unitIdText ||
                      "-"
                    }}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </van-cell-group>
      </div>
    </select-list>

    <!-- 浏览器扫码组件 -->
    <qrcode :qrcode="codeForm.qrcode" :showClose="codeForm.showClose" v-show="codeForm.qrcode" :camera="camera"
      :torchActive="torchActive" @switchCamera="switchCamera" @ClickFlash="ClickFlash" @turnCameraOff="turnCameraOff"
      @onDecode="onDecode" @onInit="onInit" />

    <!-- 激光扫码组件 -->
    <PDAsao ref="pdaScan" @changeScan="changeScan2" />

    <!-- 批量扫码弹窗 -->
    <van-popup v-model="isshow" :overlay="true" position="bottom" :style="{ height: '50%' }"
      :close-on-click-overlay="false">
      <div class="qrcodeModel" v-if="entryDetails[recentGoodsIndex]">
        <div class="nav_contain">
          <!--          <span class="left" >-->
          <van-icon :size="20" color="#3ba1ff" @click="closeModel" name="arrow-left" />
          <!--          </span>-->
          <span class="center"> 出库物品库位 </span>
          <span class="right" @click="closeModel"> 确定 </span>
        </div>
        <div class="kw-list">
          <div class="wrap">
            <div class="top">
              <div class="title titleWidth">
                {{ entryDetails[recentGoodsIndex].goodsCode }} |
                {{ entryDetails[recentGoodsIndex].goodsName }} |
                {{ entryDetails[recentGoodsIndex].spec }}
              </div>
            </div>
            <div class="center">
              <div>
                <p>
                  <span class="key">产地：</span>
                  <span class="value">{{
                    entryDetails[recentGoodsIndex].address || "-"
                  }}</span>
                </p>
                <p>
                  <span class="key">包装规格：</span>
                  <span class="value">{{
                    entryDetails[recentGoodsIndex].packageSpec || "-"
                  }}</span>
                </p>
                <p style="margin-top: 8px">
                  <van-tag color="#e8f4ff" text-color="#1890ff">{{ entryDetails[recentGoodsIndex].produceDate }}
                  </van-tag>
                  <van-tag color="#e8f4ff" text-color="#1890ff">{{ entryDetails[recentGoodsIndex].batchCode }}
                  </van-tag>
                  <van-tag color="#e8f4ff" text-color="#1890ff">{{ entryDetails[recentGoodsIndex].unitName }}
                  </van-tag>
                </p>
              </div>
            </div>
            <div style="height: 6px; background-color: #f3f3f3; width: 100%"></div>
            <div class="list1">
              <div class="" v-for="(p, i) in entryDetails[recentGoodsIndex].itemList" :key="p.latticeId"
                v-show="entryDetails[recentGoodsIndex].itemList.length != 0">
                <van-cell-group>
                  <p class="otherText">
                    <span style="
                        font-size: 14px;
                        display: flex;
                        align-items: center;
                        padding-left: 6px;
                      ">
                      <span class="icon"></span>
                      {{ p.latticeCode || "-" }} {{ p.latticeName || "-" }}
                    </span>
                    <span class="deleteStyle" @click="
                      deleteLattice(
                        i,
                        entryDetails[recentGoodsIndex].itemList.length
                      )
                      ">删除</span>
                  </p>
                  <div class="bottomLine"></div>
                  <van-cell-group class="formItemFlex">
                    <p class="label" style="
                        color: #888;
                        min-width: 3.3rem;
                        padding-top: 0.33rem;
                      ">
                      库位库存：
                    </p>
                    <div class="haveUnitBox">
                      {{ p.goodsNumText }}
                    </div>
                  </van-cell-group>
                  <van-cell-group class="formItemFlex">
                    <p class="label required FormTit">出库数量</p>
                    <div class="haveUnitBox">
                      <van-field v-model="p.outboundQuantity" type="number" placeholder="请输入" input-align="right"
                        :formatter="(e) => clearNoNum()(e, p.available)">
                        <template #right-icon>
                          <span>{{
                            entryDetails[recentGoodsIndex].unitName || ""
                          }}</span>
                        </template>
                      </van-field>
                    </div>
                  </van-cell-group>
                </van-cell-group>
                <div style="height: 6px; background-color: #f3f3f3; width: 100%"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </van-popup>
  </div>
</template>
<script>
import { getAction } from "@/api/manage";
import moment from "moment";
import Navbar from "../../../components/navBar/navBar_right_outTask";
import scanInputOutTask from "../../../components/scanCode/scanInputOutTask.vue";
import PDAsao from "../../../components/scanCode/PDAsao.vue";
import {
  outboundOrderTypeList,
  // formTypeExtendedFieldList,
  wmsWarehouseOperateAdd,
  outboundOrderEdit,
  outboundOrderDetail,
  inventoryOrderDetailList,
  getOutboundOrderLatticeGoods,
} from "@/api/mobile";
import VanFieldSelectPicker from "@/components/ActionSheet/VanFieldSelectPicker";
import GoodsPickers from "../../../components/choiceuse/GoodsPickers";
import store from "@/store";
import scanInputGoods from "@/components/scanCode/scanInputGoods";
import { APILX } from "@/api/requestLx";
import { workOrderList } from "@/api/productionApply";
import { getDictItemsByTypes, genEntityCode } from "@/api/inventoryOrder";
import BinLocationPickersAk from "../../../components/choiceuse/BinLocationPickersAk";
import SelectList from "../../../components/pageList/selectList.vue";
import {
  getDistributeLatticeNotification,
  getGoodsById,
  getLatticeNotificationForOutBound,
  getOutboundOrderNotification,
  warehouseLatticeDetail,
} from "../../../api/mobile";
import { Dialog } from "vant";
import { getWarehouseLatticeDetail } from "../../../api/inventoryOrder";
import { clearNoNum } from "../../../utils/util";
import goBack$ from "dingtalk-jsapi/api/biz/navigation/goBack";

export default {
  name: "inventoryOrderForm",
  components: {
    Navbar,
    VanFieldSelectPicker,
    GoodsPickers,
    scanInputGoods,
    BinLocationPickersAk,
    scanInputOutTask,
    SelectList,
    qrcode: () => import("@/components/scanCode"),
    PDAsao,
  },
  data() {
    return {
      subLoading: false,
      selectLattice: false,
      columnsData: {
        listShow: false, //控制列表选择显示
        title: "出库物品库位", //列表名称
        checkedShow: true, //列表是否支持多选
        operationTxt: "确定", //选择按钮名称
        query: {
          itemList: [],
          goodsCode: "",
          goodsName: "",
          spec: "",
          packageSpec: "",
          address: "",
          produceDate: "",
          batchCode: "",
          unitName: "",
          unitIdText: "",
          latticeCode: "",
          latticeName: "",
        },
        isSelectAll: false,
        len: 0,
        total: 0,
        listUrl: "/wmslattice/getDistributeLatticeNotification", //列表接口
        columns: {
          //列表是否使用插槽
          headSlot: true, //头部插槽
          bodySlot: false, //中间内容插槽
          labelSlot: false, //标签插槽
          footSlot: false, //底部插槽
          titleKey: ["latticeCode", "latticeName"], //标题
          min: 5,
          content: [],
          labelKey: [], //标签
          operationText: "",
          flowStatusNameKey: "dictName", //流程状态
          // 多种操作
          operation: [],
          // 固定且只有一个操作
          // operationText:'发起流程'
        },
      },
      isshow: false,
      // 扫码相关
      codeForm: {
        qrcode: false,
        showClose: false,
      },
      torchActive: true,
      goodsFlag: false,
      camera: "off",
      allDownShow: false,
      active: "",
      isToggle: false, // 是否点击了请选择或扫码按钮，做标记用
      showSubBtn: false,
      activeKw: {
        totalNum: 0,
      }, // 激活的库位

      tabsConfig: {
        all: false,
        showIndex: 0,
      },
      detailInfo: {},
      scanType: "", // 扫码类型，点击的是哪里的扫码按钮
      goodsDetailsList: [],
      activeIndex: 0,
      examKey: 1,
      //辅助单位
      buildForm: {
        entryCode: "",
        taskCode: "",
        operateTime: "",
        operateTaskType: "SALE",
        produceOrderId: "",
        produceOrderName: "",
        receiverPersion: "",
        receiverPersionName: "",
        outWarehouseTime: "",
        extDataJson: {},
      },
      isShowLatticeNotification: false,
      listlatticeNotificationUrlUrl: "/wmslattice/getLatticeNotification",
      listlatticeNotificationUrlGoodUrl:
        "/wmsgoodsnotification/getOutboundOrderNotification",
      latticeNotificationUrl: "",
      latticeNotificationgColumns: {
        query: {},
        titleKey: ["latticeCode", "latticeName"], //标题
        content: [
          //内容
          {
            name: "库位物品",
            key: ["goodsNameTxt"],
          },
          {
            name: "物品数量",
            key: ["goodsNumTxt"],
          },
          {
            name: "物品总数量",
            key: ["totalNum"],
          },
        ],
        labelKey: [], //标签
        operationText: "",
      },
      timePickShow: false,
      recentGoodsIndex: 0,
      entryDetails: [],
      happenTime: new Date(),
      appTitle: "新建出库",
      showScan: true, // 是否显示扫码图标
      isEdit: false,
      isSelectAll: false,
      clickKw: {
        itemList: [],
      },
      parentId: "",
      showExam: true,
      warehousingTypes: [],
      selectShow: false,
      formTypeExtendedFields: [],
      goodsTypeExtendedFields: [],
      showGoodsPicker: false,
      activeGoodInfo: {
        itemList: [],
      },
      cusStyle: {
        height: "calc( 100vh - 95px)",
      },
      listUrl: "/wmsgoodsnotification/getOutboundOrderNotification",
      goodsColumns: {
        titleKey: ["goodsCode", "goodsName", "spec"], //标题
        content: [
          //内容
          {
            name: "包装规格",
            key: ["packageSpec"],
          },
          {
            name: "产地",
            key: ["address"],
          },
          {
            name: "库存数量",
            key: ["totalNum"],
          },
        ],
        labelKey: ["produceDate", "batchCode", "unitName"], //标签
        operationText: "",
      },
      selectedSaleOrder: [],
      selectedProduceOrder: [],
    };
  },
  beforeRouteLeave(to, from, next) {
    console.log(this.columnsData.listShow);
    console.log(this.asCheckedShow);
    if (this.showPeopleSlect) {
      this.$refs.examine.closePicker();
      next(false);
    } else if (this.isShowLatticeNotification) {
      this.isShowLatticeNotification = false;
      this.showScan = true;
      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
      next(false);
    } else if (this.showGoodsPicker || this.showSaleOrderPickers) {
      this.showGoodsPicker = false;
      this.showSaleOrderPickers = false;
      this.showScan = true;
      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
      next(false);
    } else {
      next();
    }
  },
  async created() {
    let _this = this;
    getDictItemsByTypes({ type: 4 }).then((res) => {
      if (res.code == 200 && res.result) {
        _this.warehousingTypes = res.result;
        console.log("类型", _this.warehousingTypes);
      }
    });
    // 扫工单码进入
    if (
      this.$route.query.formPage == "scanCode" &&
      this.$route.query.code.EntityType == "workOrder"
    ) {
      let itemRes = await workOrderList({ id: this.$route.query.code.id });
      this.getCheckedProduceOrder(itemRes.result.records);
    }
    // 扫物品码进入
    if (
      this.$route.query.formPage == "scanCode" &&
      this.$route.query.code.EntityType == "goods"
    ) {
      this.changeScan(this.$route.query, "scan");
    }

    store.commit("SET_CURRENT_PREFIX", "/jksaas-produce/produce");
    if (this.$route.query.id) {
      this.isEdit = true;
      this.parentId = this.$route.query.id;
    } else {
      this.isEdit = false;
      this.parentId = "";
    }
    this.buildForm.outWarehouseTime = moment(this.happenTime).format(
      "YYYY-MM-DD HH:mm"
    );
    let currentLoginUser = JSON.parse(
      localStorage.getItem("pro__Login_Userinfo")
    ).value;
    console.log("currentLoginUser", currentLoginUser);
    this.buildForm.receiverPersion = currentLoginUser.id;
    this.buildForm.receiverPersionName = currentLoginUser.realname;
    if (this.parentId) {
      this.appTitle = "编辑出库单";
      // 出库单表单详情
      outboundOrderDetail({ id: this.parentId }).then((res) => {
        if (res.code == 200) {
          let resObj = res.result;
          this.buildForm = res.result;
          if (resObj.orderCode) {
            this.buildForm.saleOrderName = resObj.orderCode;
          }
        }
      });
      getGoodsById({ id: this.parentId }).then((res) => {
        if (res.code == 200) {
          this.goodsDetailsList = res.result.records;
          this.goodsDetailsList.forEach((item) => {
            item.goodsKey = item.id;
          });
        } else {
          this.$toast(res.message);
        }
      });
    } else {
      this.initData(); // 新建出库单的时候，初始化日期和出库单编号等信息
    }
  },
  methods: {
    closeGoodsKwPop() {
      console.log('关闭了物品库位选择');
      this.columnsData.listShow = false
      this.$nextTick(() => {
        this.$refs.pdaScan.initFocus()
      })
    },
    clearNoNum() {
      return clearNoNum;
    },
    // 删除库位
    deleteLattice(index, recListLength) {
      if (recListLength === 1) {
        return;
      } else {
        this.entryDetails[this.recentGoodsIndex]["itemList"].splice(index, 1);
      }
      this.$forceUpdate();
    },
    selectKw(p) {
      console.log(p);
      this.activeKw = p;
      this.isToggle = true;
      this.isSelectAll = false;
      let good = this.getActiveGoodInfo();
      this.columnsData.query = good;
      this.columnsData.isSelectAll = false;
      this.columnsData.listUrl = `/wmslattice/getLatticeNotificationForOutBound?goodsId=${good.goodsId}&batchCode=${good.batchCode}`;
      this.columnsData.checkedShow = false;
      this.columnsData.listShow = true;
      this.selectLattice = true;
      this.appTitle = "选择库位";
    },
    getActiveGoodInfo() {
      return this.goodsDetailsList.find(
        (item) => item.goodsKey === this.active
      );
    },
    changeQuantity(e) {
      console.log(e, 'ee');
    },
    listData(list) {
      console.log(list, "listtttt");
      let total = 0;
      if (this.isSelectAll || this.selectLattice) {
        list.forEach((item) => {
          total += item.goodsNum;
          this.$set(item, "outboundQuantity", item.goodsNum || 0);
        });
      } else {
        list.forEach((item) => {
          total += item.totalNums;
          this.$set(item, "outboundQuantity", item.totalNums || 0);
        });
      }

      console.log(list.length, total);
      this.columnsData.len = list.length;
      this.columnsData.total = total;
    },
    /*收货数量 处理*/
    newClearNoNum(value, maxValue) {
      //先把非数字的都替换掉，除了数字和.
      value = value.replace(/[^\d.]/g, "");
      //保证只有出现一个.而没有多个.
      value = value.replace(/\.{2,}/g, ".");
      //必须保证第一个为数字而不是.
      value = value.replace(/^\./g, "");
      //保证.只出现一次，而不能出现两次以上
      value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
      //只能输入四个小数
      value = value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, "$1$2.$3");
      // console.log(value.includes('.'),'wwwwww')
      //小数位处理
      if (value.substring(0, 1) == "0" && value.substring(0, 2) != "0.") {
        value = "0";
      }
      //输入长度控制
      if (value > 99999999999999.9999) {
        value = "";
        this.$toast("最多可输入14个字符，小数点后4位");
      }

      if (value > maxValue) {
        value = maxValue;
        this.$toast("不能输入大于该库位下的库存数量");
      }

      return value;
    },
    // 单击时删除当前库位模块，若该物品明细对应的出库库位、出库数量只有一个模块，则删除时需要二次确认，确认后则该物品移除。
    deleteGoodsLattice(index, idx) {
      if (this.goodsDetailsList[index].itemList.length === 1) {
        Dialog.confirm({
          title: "确定删除后则该物品移除？",
          confirmButtonColor: "#2b85e4",
        })
          .then(() => {
            this.goodsDetailsList.splice(index, 1);
          })
          .catch(() => { });
      } else {
        this.goodsDetailsList[index].itemList.splice(idx, 1);
      }
      this.$forceUpdate();
    },
    showLatticeNotificatios(index, val, url, flag) {
      console.log(index, val, url);
      let item = null;
      if (index >= 0) {
        item = this.goodsDetailsList[index];
      } else if (val) {
        item = val;
      }
      console.log(item, "item", this.goodsDetailsList[index]);
      this.columnsData.query = item;
      this.columnsData.checkedShow = true;
      this.columnsData.listUrl =
        url ||
        `/wmslattice/getLatticeNotificationForOutBound?goodsId=${this.goodsDetailsList[index].goodsId}&batchCode=${this.goodsDetailsList[index].batchCode}`;
      this.columnsData.listShow = true;
      this.isSelectAll = true;
      this.columnsData.isSelectAll = true;
    },
    // tag 弹出层相关功能
    openDropDownModel() {
      this.allDownShow = true;
    },
    closeDropDownModel() {
      this.allDownShow = false;
    },
    clickGoodsNames(item) {
      this.active = item.goodsKey;
      console.log(item, item.goodsKey);
      this.allDownShow = false;
    },
    scanIconClick(p) {
      let activeItem = this.goodsDetailsList.find(
        (item) => item.id === this.active
      );
      console.log("点击了", activeItem);
      this.$toast("点击了扫码图标");
    },
    // 上方所有的 库位选择
    showLatticeNotification(index, url) {
      this.columnsData.isSelectAll = true;
      this.isSelectAll = true;
      this.showScan = false;
      this.appTitle = "库位";
      this.isShowLatticeNotification = true;
      this.recentGoodsIndex = index;
      this.latticeNotificationUrl = url || this.listlatticeNotificationUrlUrl;
    },
    // 确认选中
    getCheckedValueList(id, item, text) {
      console.log("this.isSelectAll", this.isSelectAll, item);
      this.clickKw = item;
      this.showScan = true;
      // 如果是点击了物品tab上方的库位按钮，选择库位
      if (this.isSelectAll) {
        // 获取库位下的物品
        this.columnsData.title = "出库库位物品";
        this.isSelectAll = true;
        this.columnsData.listShow = true;
        this.isSelectAll = false;
        this.columnsData.isSelectAll = false;
        this.columnsData.query = item;
        this.columnsData.listUrl = `/wmsgoodsnotification/getOutboundOrderLatticeGoods?latticeId=${item.id}`;
      } else {
        if (!this.isToggle) {
        } else {
          console.log(item, "这是点击的库位信息：", item);
          console.log(this.activeKw);
          this.activeKw.latticeName = item.latticeCode + "|" + item.latticeName;
          this.activeKw.latticeId = item.id;
          this.activeKw.outboundQuantity = item.totalNum;
          this.activeKw.totalNum = item.totalNum;
          this.activeKw.goodsBatchId = item.goodsBatchId;
        }
      }
      this.isShowLatticeNotification = false;
    },

    setKwGoodsColumns() {
      this.columnsData.title = "出库库位物品";
      this.isSelectAll = true;
      this.columnsData.listShow = true;
      this.isSelectAll = false;
      this.columnsData.isSelectAll = false;
    },

    // 物品选择库位 回调
    getCheckedValuess(id, list, text) {
      console.log("11111111111");
      // 确定时，进行校验，只对选中的进行提交和校验。同一个物品下的、批号、出库库位的组合不能重复，若新建出库页面已存在的，则提示“库位编号|库位名称已存在”；
      //校验通过后，则把该物品及批次信息回显到TAB下，并把选中的库位及出库数量回填到该物品下。
      if (this.isSelectAll) {
        console.log("22222222");
        console.log(
          this.goodsDetailsList,
          "goodsDetailsList",
          this.columnsData.query
        );
        //   判断物品列表是否存在选择的物品，如果有，就判断选择的库位是否已存在
        let exit = this.goodsDetailsList.some(
          (item) => item.goodsId === this.columnsData.query.goodsId
        );
        console.log("exitexit", exit);
        if (!exit) {
          this.goodsDetailsList.push(this.columnsData.query);
          this.addKwItem(this.columnsData.query.itemList, list);
        } else {
          let exitItem = this.goodsDetailsList.find(
            (item) => item.goodsId === this.columnsData.query.goodsId
          );
          this.addKwItem(exitItem.itemList, list);
        }
      } else if (this.selectLattice) {
        let exit = this.goodsDetailsList.some(
          (item) => item.goodsId === this.columnsData.query.goodsId
        );
        console.log("exitexit", exit);
        if (!exit) {
          this.goodsDetailsList.push(this.columnsData.query);
          this.addKwItem(this.columnsData.query.itemList, list);
        } else {
          let exitItem = this.goodsDetailsList.find(
            (item) => item.goodsId === this.columnsData.query.goodsId
          );
          this.addKwItem(exitItem.itemList, list);
        }
      } else {
        console.log("333333333");
        // 选择库位下的物品的回调
        if (!this.goodsDetailsList.length) {
          console.log(
            "没有物品的情况",
            this.goodsDetailsList,
            this.clickKw,
            list
          );
          list.forEach((ele) => {
            this.$set(ele, "itemList", []);
            ele.itemList.push({
              latticeId: this.clickKw.id,
              outboundQuantity: ele.outboundQuantity,
              latticeName: this.clickKw.latticeName,
              latticeCode: this.clickKw.latticeCode,
            });
            this.goodsDetailsList.push(ele);
          });
        } else {
          let goodItems = this.goodsDetailsList.find(
            (item) => item.goodsKey === this.activeGoodInfo.goodsKey
          );
          console.log(
            "goodItems",
            goodItems,
            444444,
            this.activeGoodInfo,
            this.goodsDetailsList
          );
          // this.addKwItem(goodItems ? goodItems.itemList : [], list);

          list.forEach((ele) => {
            this.$set(ele, "itemList", []);
            ele.itemList.push({
              latticeId: this.clickKw.id,
              outboundQuantity: ele.outboundQuantity,
              latticeName: this.clickKw.latticeName,
              latticeCode: this.clickKw.latticeCode,
            });
            // this.goodsDetailsList.push(ele)
            this.addItem(this.goodsDetailsList, ele);
          });
          //   判断选择的物品的库位是否已存在
        }
      }

      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
    },

    scanKwItem(initialArray, newItems) {
      console.log("initialArray", initialArray);
      newItems.forEach((newItem) => {
        newItem.latticeId = newItem.id;
        const existingItem = initialArray.find(
          (item) => item.latticeId === newItem.id
        );
        if (existingItem) {
          console.log("existingItem", existingItem);
          this.$toast(
            `${existingItem.latticeCode}|${existingItem.latticeName}已存在`
          );
        } else {
          console.log("existingItem", existingItem);
          // console.log('newItem', newItem)
          initialArray.push(newItem);
        }
      });
    },

    // 校验统一物品下的重复的库位
    addKwItem(initialArray, newItems) {
      console.log("initialArray", initialArray);
      newItems.forEach((newItem) => {
        newItem.latticeId = newItem.id;
        const existingItem = initialArray.find(
          (item) => item.latticeId === newItem.id
        );
        if (existingItem) {
          console.log("existingItem", existingItem);
          this.$toast(
            `${existingItem.latticeCode}|${existingItem.latticeName}已存在`
          );
        } else {
          console.log("existingItem", existingItem);
          // console.log('newItem', newItem)
          initialArray.push(newItem);
        }
      });
    },

    // 确认选中库位
    getCheckedValue(id, son, text) {
      console.log("选中库位", son);
      this.isShowLatticeNotification = false;
      this.activeKw.latticeId = son.id;
      this.activeKw.latticeName = son.latticeCode + "|" + son.latticeName;
      this.activeKw.outboundQuantity = son.goodsNum || son.totalNums;
      this.activeKw.totalNum = son.goodsNum || son.totalNum;
    },
    async getCheckedValues(list) {
      this.showGoodsPicker = false;
      this.entryDetails = list.map((son) => {
        let recIndex = this.entryDetails.findIndex(
          (ele) => ele.serialId == son.id
        );

        if (recIndex != -1) {
          let recObj = this.entryDetails[recIndex];
          return recObj;
        } else {
          let { goodsBatchId, latticeId, pickingQuantity, taskDetailId } = son;

          return {
            goodsBatchId: goodsBatchId,
            latticeId: latticeId,
            pickingQuantity: pickingQuantity,
            taskDetailId: this.parentId,
          };
        }
      });
    },
    // 物品明细-》删除
    deleteGoods(i) {
      this.entryDetails.splice(i, 1);
    },
    //出库类型选择
    selectReport(itemReport, key) {
      if (itemReport) {
        this.buildForm[key] = itemReport.value;
      } else {
        this.buildForm[key] = "";
      }
    },
    // 打开选择时间
    openTimePicker(index, value) {
      this.timePickShow = true;
      this.recentGoodsIndex = index;
      if (value) {
        this.happenTime = value;
      } else {
        this.happenTime = "";
      }
    },
    // 出库类型 清空 生产订单 销售订单相关字段
    inWarehouseTypeConfirm(data1, index, data2) {
      if (data1) {
        let that = this;
        if (that.buildForm.outWarehouseType != data2) {
          this.buildForm.produceOrderId = "";
          this.buildForm.produceOrderName = "";

          this.buildForm.saleOrderId = "";
          this.buildForm.saleOrderName = "";

          this.entryDetails = [{}];
          this.$forceUpdate();
        }
      }
    },
    // 自定义字段格式化
    clearNoNumTwo(value, type) {
      if (type != 3) {
        return value;
      } else {
        return value.replace(/[^\d]/g, "");
      }
    },
    // 提交 - 表单验证
    btnConfirm() {
      if (!this.buildForm.taskCode) {
        this.$toast(`请输入出库单编号`);
        return;
      }
      if (!this.buildForm.operateTaskType) {
        this.$toast(`请选择业务类型`);
        return;
      }

      console.log("this.goodsDetailsList", this.goodsDetailsList);

      try {
        // 出库物品明细 为空 选项名称、数量 表单验证
        if (this.goodsDetailsList && this.goodsDetailsList.length > 0) {
          this.goodsDetailsList.forEach((element, index) => {
            element.itemList.forEach((item, i) => {
              if (!item.latticeName) {
                throw new Error(
                  `${element.goodsName} 库位（${index + 1}）出库库位不可为空`
                );
                this.$toast(`出库单物品明细（${index + 1}）出库库位不可为空`);
                return;
              }
              if (!item.outboundQuantity || item.outboundQuantity == "") {
                throw new Error(
                  `${element.goodsName} 库位（${index + 1}）数量不可为空`
                );
                this.$toast(`出库单物品明细（${index + 1}）数量不可为空`);
                return;
              }
            });
          });
        } else {
          throw new Error(`请选择物品`);
          this.$toast(`请选择出库物品`);
          return;
        }
      } catch (error) {
        this.$toast(error.message);
        return false;
      }

      this.handleSubmit();
    },
    handleSubmit() {
      let goodsList = [];
      this.goodsDetailsList.forEach((element, index) => {
        element.itemList.forEach((item, i) => {
          goodsList.push({
            goodsId: element.goodsId,
            goodsNum: item.outboundQuantity,
            latticeId: item.latticeId,
            goodsBatchId: element.goodsBatchId,
            detailId: item.taskDetailId,
          });
        });
      });
      console.log("this.goodsDetailsList", this.goodsDetailsList);
      let params = {
        ...this.buildForm,
        operateType: "2",
        operateTaskType: this.buildForm.operateTaskType,
        operateTime: this.buildForm.operateTime,
        goodsList,
      };
      console.log("params", params);

      let commitApi = "";
      let successMeg = "";
      if (this.parentId) {
        params.id = this.parentId;
        commitApi = outboundOrderEdit;
        successMeg = "出库单编辑成功！";
      } else {
        commitApi = wmsWarehouseOperateAdd;
        successMeg = "出库单创建成功！";
      }
      this.subLoading = true;
      commitApi(params)
        .then((res) => {
          if (res.success) {
            this.$toast(successMeg);
            this.$router.go(-1);
          } else {
            this.$toast(res.message);
          }
        })
        .finally(() => {
          this.subLoading = false;
        });
    },
    // 初始化页面数据
    initData() {
      // 生产出库单任务编号
      genEntityCode({ entityCode: "WAREHOUSE_OPERATE_OUT" }).then((res) => {
        if (res.code == 200) {
          this.buildForm.taskCode = res.result;
        } else {
          this.buildForm.taskCode = "";
          this.$toast(res.message);
        }
      });
      // 单据日期 默认当天
      this.buildForm.operateTime = moment(new Date()).format("YYYY-MM-DD");
    },
    // 确定选择时间
    confirmPick(date) {
      this.buildForm.outWarehouseTime = moment(date).format("YYYY-MM-DD");
      this.timePickShow = false;
    },
    // 取消选择时间
    cancelPick() {
      this.timePickShow = false;
    },
    formatter(type, val) {
      if (type === "year") {
        return val + "年";
      }
      if (type === "month") {
        return val + "月";
      }
      if (type === "day") {
        return val + "日";
      }
      if (type === "hour") {
        return val + "时";
      }
      if (type === "minute") {
        return val + "分";
      }
      return val;
    },
    // 出库物品明细-》添加
    addInventoryGoods() {
      this.appTitle = "物品";
      this.showGoodsPicker = true;
      this.showScan = false;
    },
    addItem(arr, newItem) {
      console.log(arr);
      // 校验是否已存在该物品及对应的批次
      const existingItem = arr.find(
        (item) =>
          item.goodsId === newItem.goodsId &&
          item.batchCode === newItem.batchCode
      );
      if (existingItem) {
        let label = existingItem.goodsCode + "|" + existingItem.goodsName;
        console.log("该物品已存在");
        this.$toast(`${label}` + "已存在");
        return;
      }
      // 若不存在，则将新数据追加到数组中
      arr.push(newItem);
    },
    handleList(id, val) {
      console.log(val, "valllll");
      this.activeGoodInfo = val;
      // 直选物品
      val.itemList = [];
      val.goodsKey = val.id;
      this.showGoodsPicker = false;
      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
      this.columnsData.title = "出库物品库位";
      //  物品及对应的批次不能重复，选到重复的，则提示“该物品已存在”
      let item = val;
      this.columnsData.query = item;
      this.columnsData.checkedShow = true;
      console.log("9999999", item);

      this.columnsData.listUrl = `/wmslattice/getLatticeNotificationForOutBound?goodsId=${item.goodsId}&batchCode=${item.batchCode}`;
      this.columnsData.listShow = true;
      this.isSelectAll = true;
      this.columnsData.isSelectAll = true;
      this.showScan = true;
    },
    handleList1(id, batchCode, val) {
      console.log(val, "valllll");
      this.activeGoodInfo = val;
      // 直选物品
      val.itemList = [];
      val.goodsKey = val.id;
      this.showGoodsPicker = false;
      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
      this.columnsData.title = "出库物品库位";
      //  物品及对应的批次不能重复，选到重复的，则提示“该物品已存在”
      let item = val;
      this.columnsData.query = val;
      // this.columnsData.checkedShow = true;
      console.log("9999999", item);

      this.columnsData.listUrl = `/wmslattice/getLatticeNotificationForOutBound?goodsId=${id}&batchCode=${batchCode}`;
      this.columnsData.listShow = true;
      this.selectLattice = true;
      this.isSelectAll = false;
      this.showScan = true;
    },
    // 确认选中物品
    async getCheckedGoods(list) {
      console.log("选择的物品：", list);
      // 直选物品
      this.showGoodsPicker = false;
      this.showScan = true;
      this.appTitle = this.isEdit ? "编辑出库单" : "新建出库单";
      list.forEach((son, index) => {
        console.log(son, "sonnnn");
        let recIndex = this.goodsDetailsList.findIndex(
          (ele) => ele.id == son.id
        );
        let extData = {};
        if (son.extDataJson) {
          extData = son.extDataJson;
        }
        if (recIndex != -1) {
          let recObj = this.goodsDetailsList[recIndex];
          return recObj;
        } else {
          this.goodsDetailsList.push({
            goodsKey: son.id + "-" + index,
            goodsId: son.id,
            serialLongName: son.serialNumber + "|" + son.serialName,
            serialName: son.serialName || "-",
            serialNumber: son.serialNumber || "-",
            serialSpecifications: son.serialSpecifications || "-",
            serialUnit: son.unitName || "-",
            inWarehouseNum: null,
            ...son,
            inLatticeDtoList: [],
            itemList: [{}],
          });
        }
      });
      console.log("goodsDetailsList", this.goodsDetailsList);
    },
    scanCode(scanType, p) {
      console.log("点击扫码图标了", scanType);
      this.scanType = scanType;
      this.activeKw = p;
      this.showSubBtn = true;
    },
    toggleCode(scanType, p) {
      this.scanType = scanType;
      this.activeKw = p;
      this.showSubBtn = true;
    },
    // 扫码获取物品
    changeScan(v, opratorType) {
      console.log(v, this.scanType, "this.scanType");
      if (opratorType == "scan") {
        if (v.code.EntityType !== "lattice" && v.code.EntityType !== "goods") {
          this.$toast("请扫正确二维码");
        } else if (v.code.EntityType === "goods") {
          // 扫描物品二维码
          getLatticeNotificationForOutBound(v.code.id, v.code.batchCode).then(
            (res) => {
              if (res.code == 200) {
                this.handleList(v.code.id, res.result);
              } else {
                this.$toast(res.message);
              }
            }
          );
        } else if (v.code.EntityType === "lattice") {
          // 扫描库位二维码
          // 扫描库位码，回调查询库位信息
          warehouseLatticeDetail(v.code.id).then((res) => {
            console.log(res);
            if (res.code == 200) {
              let rst = res.result;
              if (this.scanType === "global") {
                console.log(this.goodsDetailsList);
                this.isSelectAll = true;
                this.getCheckedValueList(v.code.id, res.result);
              } else if (this.scanType === "kw1") {
                this.activeKw.latticeId = res.result.id;
                this.activeKw.outboundQuantity = "";
                this.activeKw.latticeName =
                  res.result.latticeCode + "|" + res.result.latticeName;
              }
            } else {
              this.$toast(res.message);
            }
          });
        }
      }
    },

    changeScan1(v, opratorType) {
      console.log(v, this.scanType, "this.scanType——右上角扫码");
      if (opratorType == "scan") {
        if (
          v.code.EntityType !== "lattice" &&
          v.code.EntityType !== "goods" &&
          v.EntityType !== "goods" &&
          v.EntityType !== "lattice"
        ) {
          this.$toast("请扫正确二维码");
        } else if (v.code.EntityType === "goods") {
          // 扫描物品二维码
          getOutboundOrderNotification({
            goodsId: v.code.id,
            batchCode: v.code.batchCode,
          }).then((res) => {
            if (res.code == 200) {
              this.handleList1(
                v.code.id,
                v.code.batchCode,
                res.result.records[0],
                res.result.total
              );
            } else {
              this.$toast(res.message);
            }
          });
        } else if (v.code.EntityType === "lattice") {
          // 扫描库位二维码
          // 扫描库位码，回调查询库位信息
          warehouseLatticeDetail(v.code.id).then((res) => {
            console.log(res);
            if (res.code == 200) {
              this.scanType = "global";
              let rst = res.result;
              if (this.scanType === "global") {
                console.log(this.goodsDetailsList);
                this.isSelectAll = true;
                this.columnsData.checkedShow = true;
                this.getCheckedValueList(v.code.id, res.result);
              } else if (this.scanType === "kw1") {
                this.activeKw.latticeId = res.result.id;
                this.activeKw.outboundQuantity = "";
                this.activeKw.latticeName =
                  res.result.latticeCode + "|" + res.result.latticeName;
              }
            } else {
              this.$toast(res.message);
            }
          });
        }
      }
    },

    closeScan() {
      console.log("关闭", this.showSubBtn, this.columnsData.listShow);
      this.showSubBtn = false;
      this.columnsData.listShow = false;

      console.log("关闭", this.showSubBtn, this.columnsData.listShow);
    },
    ClickRight() {
      this.showGoodsPicker = false;
      // this.$router.push({
      //   path: "/application",
      // });
    },
    // 打开相机
    clickCode(index, cIndex, isshow) {
      let that = this;
      this.recentGoodsIndex = index;
      this.recentLatIndex = cIndex;
      this.isshow = isshow;
      // return
      let platform = localStorage.getItem("currentEnvironment");
      console.log("platform", platform);
      switch (platform) {
        case "iwork":
          var opt = {
            success: function (res) {
              console.log(JSON.stringify(res), "APP扫码数据");
              if (res.retCode == 0) {
                that.onDecode(res.retData);
              } else {
                that.$toast(res.retMsg);
              }
            },
            fail: function (err) {
              that.$toast("扫码失败！");
            },
          };
          //插件调用代码
          WorkHelper.scan(opt);
          break;
        case "browser":
          console.log("打开摄像头");
          // camera:: 'front'--前摄像头，'rear'后摄像头，'off'关闭摄像头，会获取最后一帧显示，'auto'开始获取摄像头
          that.codeForm.qrcode = true;
          that.camera = "rear";
          that.entryDetails = that.goodsDetailsList;
          break;
        case "dingding":
          dd.biz.util.scan({
            type: "qrCode", // type 为 all、qrCode、barCode，默认是all。
            onSuccess: function (data) {
              //onSuccess将在扫码成功之后回调
              that.onDecode(data.text);
            },
            onFail: function (err) {
              // console.error(err,'error')
            },
          });
          break;
        default:
          "";
          break;
      }
    },
    closeModel() {
      this.isshow = false;
      this.turnCameraOff();
    },
    // 关闭相机
    turnCameraOff() {
      this.camera = "off";
      this.codeForm.qrcode = false;
    },
    // 检查是否调用摄像头
    async onInit(promise) {
      try {
        await promise;
      } catch (error) {
        if (error.name === "StreamApiNotSupportedError") {
        } else if (error.name === "NotAllowedError") {
          this.errorMessage = "Hey! I need access to your camera";
        } else if (error.name === "NotFoundError") {
          this.errorMessage = "Do you even have a camera on your device?";
        } else if (error.name === "NotSupportedError") {
          this.errorMessage =
            "Seems like this page is served in non-secure context (HTTPS, localhost or file://)";
        } else if (error.name === "NotReadableError") {
          this.errorMessage =
            "Couldn't access your camera. Is it already in use?";
        } else if (error.name === "OverconstrainedError") {
          this.errorMessage =
            "Constraints don't match any installed camera. Did you asked for the front camera although there is none?";
        } else {
          this.errorMessage = "UNKNOWN ERROR: " + error.message;
        }
      }
    },
    // 激光扫码
    changeScan2(v) {
      console.log(v, "___vvvv——红外扫码");
      console.log(v.EntityType, "___v.EntityType——红外扫码");

      if (v.EntityType !== "lattice" && v.EntityType !== "goods") {
        this.$toast("请扫正确二维码");
      } else if (v.EntityType === "goods") {
        // 扫描物品二维码
        getOutboundOrderNotification({
          goodsId: v.id,
          batchCode: v.batchCode,
        }).then((res) => {
          if (res.code == 200) {
            this.handleList1(
              v.id,
              v.batchCode,
              res.result.records[0],
              res.result.total
            );
          } else {
            this.$toast(res.message);
          }
        });
      } else if (v.EntityType === "lattice") {
        // 扫描库位二维码
        // 扫描库位码，回调查询库位信息
        warehouseLatticeDetail(v.id).then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.scanType = "global";
            let rst = res.result;
            if (this.scanType === "global") {
              console.log(this.goodsDetailsList);
              this.isSelectAll = true;
              this.columnsData.checkedShow = true;
              this.getCheckedValueList(v.id, res.result);
            } else if (this.scanType === "kw1") {
              this.activeKw.latticeId = res.result.id;
              this.activeKw.outboundQuantity = "";
              this.activeKw.latticeName =
                res.result.latticeCode + "|" + res.result.latticeName;
            }
          } else {
            this.$toast(res.message);
          }
        });
      }

      // this.goodsFlag = false;
      // if (v.EntityType == "lattice") {
      //   getWarehouseLatticeDetail(v.id).then((res) => {
      //     if (res.code == 200 && res.result) {
      //       // if (res.result.status == "effective") {
      //       let { id, latticeCode, latticeName } = res.result;
      //       let recLatIndex = this.entryDetails[this.active][
      //         "itemList"
      //       ].findIndex((ele) => ele.latticeId == id);
      //       if (recLatIndex == -1) {
      //         let obj = {
      //           latticeId: id,
      //           latticeCode: latticeCode,
      //           latticeName: latticeName,
      //           latticeFullName: latticeCode + "|" + latticeName,
      //           shelvedNum: this.entryDetails[this.active]["unShelvedNum"],
      //         };
      //         this.entryDetails[this.active]["itemList"].push(obj);
      //       } else {
      //         this.$toast("该库位已存在");
      //       }
      //       // } else {
      //       //   this.$toast("该库位处于禁用状态");
      //       // }
      //     } else {
      //       this.$toast("数据异常");
      //     }
      //   });
      // } else if (v.EntityType == "goods") {
      //   // 扫描物品二维码
      //   getLatticeNotificationForOutBound(v.id, v.batchCode).then((res) => {
      //     if (res.code == 200) {
      //       this.handleList(v.id, res.result);
      //       this.goodsFlag = true;
      //     } else {
      //       this.$toast(res.message);
      //     }
      //   });
      // }
      // if (v.EntityType !== "lattice" && v.EntityType !== "goods") {
      //   this.$toast("请扫正确二维码");
      // } else if (v.EntityType === "goods") {
      //   // 扫描物品二维码
      //   getLatticeNotificationForOutBound(v.id, v.batchCode).then((res) => {
      //     if (res.code == 200) {
      //       this.handleList(v.id, res.result);
      //     } else {
      //       this.$toast(res.message);
      //     }
      //   });
      // } else if (v.EntityType === "lattice") {
      //   // 扫描库位二维码
      //   // 扫描库位码，回调查询库位信息
      //   warehouseLatticeDetail(v.id).then((res) => {
      //     console.log(res);
      //     if (res.code == 200) {
      //       let rst = res.result;
      //       if (this.scanType === "global") {
      //         console.log(this.goodsDetailsList);
      //         this.isSelectAll = true;
      //         this.getCheckedValueList(v.id, res.result);
      //       } else if (this.scanType === "kw1") {
      //         this.activeKw.latticeId = res.result.id;
      //         this.activeKw.outboundQuantity = "";
      //         this.activeKw.latticeName =
      //           res.result.latticeCode + "|" + res.result.latticeName;
      //       }
      //     } else {
      //       this.$toast(res.message);
      //     }
      //   });
      // }
    },
    // 扫码结果回调
    onDecode(result) {
      // result, 扫描结果，可以根据自己的需求来实现相应的功能
      this.codeForm.code = JSON.parse(result);
      console.log(" this.codeForm.code", this.codeForm.code);
      if (this.codeForm.code.EntityType == "lattice" && this.codeForm.code.id) {
        // 库位二维码
        getWarehouseLatticeDetail(this.codeForm.code.id)
          .then((res) => {
            if (res.code == 200 && res.result) {
              if (res.result.status == "effective") {
                if (this.isshow) {
                  // this.$toast('扫码成功')
                  getDistributeLatticeNotification({
                    goodsId: this.entryDetails[this.recentGoodsIndex].goodsId,
                    batchCode:
                      this.entryDetails[this.recentGoodsIndex].batchCode,
                    latticeId: this.codeForm.code.id,
                  }).then((res) => {
                    let list = res.result.records;
                    if (!list.length) {
                      this.$toast("未查询到对应商品所在库位");
                      this.codeForm.qrcode = true;
                      this.camera = "rear";
                      this.isshow = true;
                      return;
                    }

                    this.scanKwItem(
                      this.entryDetails[this.recentGoodsIndex]["itemList"],
                      res.result.records
                    );
                  });
                } else {
                  // 单个扫码-库位
                  let { id, latticeCode, latticeName } = res.result;
                  this.entryDetails[this.recentGoodsIndex]["itemList"][
                    this.recentLatIndex
                  ] = {
                    latticeId: id,
                    latticeCode: latticeCode,
                    latticeName: latticeName,
                    latticeFullName: latticeCode + "|" + latticeName,
                    shelvedNum:
                      this.entryDetails[this.recentGoodsIndex]["unShelvedNum"],
                  };
                  this.turnCameraOff();
                }
              } else {
                this.$toast("该库位已被禁用");
                this.clickCode(this.recentGoodsIndex);
              }
            } else {
              this.$toast(res.message);
            }
          })
          .finally(() => { });
      } else {
        this.$toast("请扫正确二维码");
        this.clickCode(this.recentGoodsIndex);
      }

      this.codeForm.qrcode = true;
      this.camera = "rear";
      this.isshow = true;
    },
    // 打开手电筒
    ClickFlash() {
      switch (this.torchActive) {
        case true:
          this.torchActive = false;
          break;
        case false:
          this.torchActive = true;
          break;
        default:
          this.$toast("错误");
      }
    },
    // 相机反转
    switchCamera() {
      switch (this.camera) {
        case "front":
          this.camera = "rear";
          break;
        case "rear":
          this.camera = "front";
          break;
        default:
          this.$toast("错误");
      }
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/theme.scss";
@import "@/views/workManagement/materialRequisition/materialForm.scss";

.wrap-apply {
  /deep/ .van-field__control--right {
    text-align: right !important;
  }
}

.tabs-contain {
  position: relative;

  /deep/ .van-tabs__nav--line.van-tabs__nav--complete {
    width: calc(100% - 120px);
  }

  /deep/ .van-tabs__wrap--scrollable .van-tab {
    width: 33%;
    min-width: 230px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .all-down-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 90px;
    font-size: 28px;
    color: rgb(25, 137, 250);
    line-height: 90px;
    text-align: center;
    background-color: #fff;

    /deep/ .van-icon {
      top: 6px;
    }
  }

  .all-down-model {
    position: absolute;
    top: 0;
    right: 0;
    width: 100vw;
    background-color: #fff;
    z-index: 9;
    border-bottom: 1px solid #f3f3f3;
    padding: 6px;

    .tags-contain {
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 10px;

      .goodsNameTag {
        width: 22%;
        margin: 10px 10px;
        padding: 5px 20px;
        background-color: #f3f3f3;
        color: #333333;
        border-radius: 5px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    .ctrBtn-contian {
      height: 50px;
      text-align: center;
      color: #1890ff;
      font-size: 24px;
      line-height: 50px;

      /deep/ .van-icon {
        top: 6px;
      }
    }
  }
}

.form-content {
  width: 100%;
  height: calc(100vh - 203px);
  background: #f5f5f5;
  overflow: scroll;
  padding: 20px 0;

  .label {
    padding: 0.2rem 0 0.32rem;
  }

  .formgroup {
    background: #ffffff;
    // padding: 0 0.16rem;
    margin-top: 0.1rem;
    margin-bottom: 0.2rem;
    padding-top: 0.1rem;

    .title {
      width: 0.58rem;
      height: 0.14rem;
      font-size: 0.15rem;
      font-family: PingFang SC;
      font-weight: 400;
      color: #191f25;
      line-height: 0.05rem;
      margin-left: 0.16rem;
    }
  }

  .search-bottoms {
    width: 100%;
    height: 100px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0px;
    padding: 0rem 11px;
    box-sizing: border-box;
    font-size: 32px;
    font-weight: 500;
    z-index: 999;

    .btnconfirm {
      flex: 1;
      background: #1890ff;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
      color: #ffffff;
    }
  }
}

.bottomLine {
  height: 1px;
  background-color: #f2f2f2;
  margin: 0 2px;
}

.otherText {
  font-size: 32px;
  font-weight: bold;
  color: #191f25;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

.haveUnitBox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding-right: 32px;

  /deep/ .van-cell {
    padding-right: 0;
    width: 600px;
  }

  /deep/ .van-field__control {
    max-width: 700px;
  }
}

/deep/ .van-nav-bar {
  z-index: 99;
}

/deep/ .van-sidebar-item--select::before {
  color: #1890ff;
  background-color: #1890ff;
}

/deep/ .van-tree-select__item--active {
  color: #1890ff;
}

/deep/ .van-tabs__content {
  height: 1px;
  background-color: #f2f2f2;
  margin: 0 2px;
}

.addGoodScontain {
  display: flex;
  flex-wrap: nowrap;

  .addgoods {
    flex: 1;
    background: #fff;
    font-size: 32px;
    text-align: center;
    height: 78px;
    line-height: 78px;
    color: #1890ff;
  }
}

.required span::after {
  left: -20px;
  top: 3px;
}

.filedClear {
  width: 28px;
  height: 28px;
}

.wrap {
  background: #fff;
  padding: 20px 0;

  .pd {
    padding: 0 20px;
  }

  .top {
    display: flex;
    justify-content: flex-start;

    .icon {
      width: 6px;
      height: 36px;
      background: #1890ff;
      margin-top: 6px;
      margin-right: 20px;
    }

    .title {
      width: 620px;
      margin-right: 20px;
      font-size: 32px;
      font-family: PingFang SC;
      font-weight: 500;
      color: #191f25;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .title-m {
      margin-left: 0.3rem;
    }

    .spot img {
      width: 40px;
      height: 40px;
    }
  }

  .center {
    p {
      margin: 16px 0px;
      font-size: 28px;
      display: flex;
      position: relative;

      .key {
        color: #888888;
      }

      .value {
        color: #191f25;
        width: 380px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .arrow {
        color: #1890ff;
        // float: right;
        // margin-right: -0.05rem;
        // display: block;
        position: absolute;
        right: -10px;
      }
    }

    .showAll {
      background: #f5f8ff;
      width: 100vw;
      margin-left: -0.15rem;
      padding: 0.15rem;
      margin-bottom: 0.15rem;
    }

    .fontAno {
      font-size: 30px;
      padding-left: 20px;
    }
  }

  .label {
    margin-left: -6px;
    margin-top: -20px;

    span {
      height: 0.62667rem;
      background: #f0f6fe;
      color: #1890ff !important;
      margin-right: 20px;
      padding: 6px 16px;
      font-size: 22px;
      border-radius: 6px;
    }
  }

  .gap {
    height: 6px;
    background-color: #eee;
  }

  .foot {
    // height: 0.33rem;
    // line-height: 0.33rem;
    display: flex;
    justify-content: space-between;
    // margin: 0.15rem 0.12rem 0 0.12rem;
    font-size: 0.14rem;

    .pictures {
      width: 0.33rem;
      height: 0.33rem;
      line-height: 0.33rem;
      text-align: center;
      color: #fff;
      background: #1890ff;
      display: block;
      border-radius: 0.06rem;
      font-size: 0.12rem;
      margin-right: 0.1rem;
    }

    .text {
      width: 1rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .opera {
      color: #1890ff;
      font-size: 0.14rem;
    }
  }
}

/deep/ .van-field__button {
  display: flex;
}

.my-style /deep/ .van-cell {
  padding-left: 0;
}

.my-style /deep/ .van-cell--required::before {
  left: -10px;
}

.tabs-contain {
  position: relative;

  /deep/ .van-tabs__nav--line.van-tabs__nav--complete {
    width: calc(100% - 120px);
  }

  /deep/ .van-tabs__wrap--scrollable .van-tab {
    width: 33%;
    min-width: 230px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .all-down-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 90px;
    font-size: 28px;
    color: rgb(25, 137, 250);
    line-height: 90px;
    text-align: center;
    background-color: #fff;

    /deep/ .van-icon {
      top: 6px;
    }
  }

  .all-down-model {
    position: absolute;
    top: 0;
    right: 0;
    width: 100vw;
    background-color: #fff;
    z-index: 9;
    border-bottom: 1px solid #f3f3f3;
    padding: 6px;

    .tags-contain {
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 10px;

      .goodsNameTag {
        width: 22%;
        margin: 10px 10px;
        padding: 5px 20px;
        background-color: #f3f3f3;
        color: #333333;
        border-radius: 5px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        text-align: center;
        height: 60px;
        line-height: 42px;
      }
    }

    .ctrBtn-contian {
      height: 50px;
      text-align: center;
      color: #1890ff;
      font-size: 24px;
      line-height: 50px;

      /deep/ .van-icon {
        top: 6px;
      }
    }
  }
}

.qrcodeModel {
  .nav_contain {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ceced1;
    height: 80px;
    align-items: center;
    padding: 0 20px;

    span {
      font-size: 32px;
    }

    .left {
      color: #3ba1ff;
    }

    .center {
      color: #191f25;
      font-weight: bolder;
    }

    .right {
      color: #3ba1ff;
    }
  }

  .kw-list {
    height: calc(50vh - 80px);
    overflow-y: auto;

    .wrap {
      background: #fff;
      width: 100vw;

      .otherText {
        display: flex;
        justify-content: space-between;
        font-size: 32px;
        color: #191f25;
        margin: 0;
        font-weight: 500;

        .deleteStyle {
          font-weight: 400;
          color: #ff4d4f;
        }
      }

      .top {
        display: flex;
        justify-content: flex-start;
        padding-top: 10px;

        .icon {
          width: 6px;
          height: 32px;
          background: #1890ff;
          margin: 6px 10px 0 10px;
        }

        .title {
          width: 602px;
          margin-right: 20px;
          font-size: 30px;
          font-family: PingFang SC;
          font-weight: 400;
          color: #191f25;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .titleWidth {
          width: 600px;
          margin: 0 25px;
        }
      }

      .center {
        margin: 0 0 30px;

        p {
          margin: 6px 25px;
          font-size: 28px;
          display: flex;
          position: relative;

          .key {
            color: #888888;
          }

          .value {
            color: #191f25;
            width: 380px;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .arrow {
            color: #1890ff;
            position: absolute;
            right: -10px;
          }

          /deep/ .van-tag {
            margin-right: 10px;
            //width: 160px;
            flex-direction: column;
            padding: 2px 0;
          }
        }
      }
    }
  }

  .list {
    .wrap {
      background: #fff;
      //width: 100vw;

      .otherText {
        display: flex;
        justify-content: space-between;
        font-size: 32px;
        color: #191f25;
        margin: 0;
        font-weight: 500;

        .deleteStyle {
          font-weight: 400;
          color: #ff4d4f;
        }
      }

      .top {
        display: flex;
        justify-content: flex-start;
        padding-top: 10px;

        .icon {
          width: 6px;
          height: 32px;
          background: #1890ff;
          margin: 6px 10px 0 10px;
        }

        .title {
          width: 602px;
          margin-right: 20px;
          font-size: 30px;
          font-family: PingFang SC;
          font-weight: 400;
          color: #191f25;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .titleWidth {
          width: 600px;
          margin: 0 25px;
        }
      }

      .center {
        margin: 0 0 30px;

        p {
          margin: 6px 25px;
          font-size: 28px;
          display: flex;
          position: relative;

          .key {
            color: #888888;
          }

          .value {
            color: #191f25;
            width: 380px;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .arrow {
            color: #1890ff;
            position: absolute;
            right: -10px;
          }

          /deep/ .van-tag {
            margin-right: 10px;
            width: 160px;
            flex-direction: column;
          }
        }
      }
    }
  }
}

.form-content {
  width: 100%;
  height: calc(100vh - 203px);
  background: #f5f5f5;
  overflow: scroll;
  padding: 20px 0;

  .formgroup {
    background: #ffffff;
    margin-top: 0.1rem;
    margin-bottom: 0.2rem;
    padding-top: 0.1rem;

    .title {
      width: 0.58rem;
      height: 0.14rem;
      font-size: 0.15rem;
      font-family: PingFang SC;
      font-weight: 400;
      color: #191f25;
      line-height: 0.05rem;
      margin-left: 0.16rem;
    }
  }

  .search-bottoms {
    width: 100%;
    height: 100px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0px;
    padding: 0rem 11px;
    box-sizing: border-box;
    font-size: 32px;
    font-weight: 500;
    z-index: 9;

    .btnconfirm {
      flex: 1;
      background: #1890ff;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
      color: #ffffff;
    }

    .btncancle {
      width: 270px;
      margin: 0 30px;
      background: #f2f2f6;
      color: #1a2026;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
    }
  }
}

.bottomLine {
  height: 1px;
  background-color: #f2f2f2;
  margin: 0 2px;
}

.haveUnitBox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding-right: 32px;

  /deep/ .van-cell {
    padding-right: 0;
    width: 600px;
  }

  /deep/ .van-field__control {
    max-width: 700px;
    // text-align: right;
  }
}

/deep/ .van-nav-bar {
  z-index: 99;
}

/deep/ .van-sidebar-item--select::before {
  color: #1890ff;
  background-color: #1890ff;
}

/deep/ .van-tree-select__item--active {
  color: #1890ff;
}

.addGoodScontain {
  display: flex;
  flex-wrap: nowrap;
  padding: 16px 0;

  .addgoods {
    flex: 1;
    background: #fff;
    font-size: 32px;
    text-align: center;
    height: 78px;
    line-height: 78px;
    color: #1890ff;
  }
}

.required span::after {
  left: -20px;
  top: 3px;
}

.filedClear {
  width: 28px;
  height: 28px;
}

.formItemFlex {
  display: flex;
  flex-direction: row;

  .FormTit {
    flex: 1;
    min-width: 3.3rem;
    padding-top: 0.33rem;
  }

  .haveUnitBox {
    flex: 1;

    .van-cell {
      width: 6.2rem;
    }
  }
}

.list {
  margin-top: 10px;

  .wrap {
    background: #fff;
    //width: 100vw;

    .otherText {
      display: flex;
      justify-content: space-between;
      font-size: 32px;
      font-weight: bold;
      color: #191f25;

      .deleteStyle {
        font-weight: 400;
        color: #ff4d4f;
      }
    }

    .top {
      display: flex;
      justify-content: flex-start;
      padding-top: 10px;

      .icon {
        width: 6px;
        height: 32px;
        background: #1890ff;
        margin: 6px 10px 0 10px;
      }

      .title {
        width: 602px;
        margin-right: 20px;
        font-size: 30px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #191f25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .titleWidth {
        width: 600px;
        margin: 16px 25px;
      }
    }

    .center {
      margin: 0 0 30px;

      p {
        margin: 6px 25px;
        font-size: 28px;
        display: flex;
        position: relative;

        .key {
          color: #888888;
        }

        .value {
          color: #191f25;
          width: 380px;
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .arrow {
          color: #1890ff;
          position: absolute;
          right: -10px;
        }

        /deep/ .van-tag {
          margin-right: 10px;
          width: 160px;
          flex-direction: column;
        }
      }

      .showAll {
        background: #f5f8ff;
        width: 100vw;
        margin-left: -30px;
        padding: 30px;
        margin-bottom: 30px;
      }

      .showAll2 {
        width: 100%;
        margin: 0 0 30px 0;
        padding: 30px 0;
      }
    }
  }
}

.d-head {
  width: 100%;
  padding: 32px;
  background: #ffffff;
  margin-bottom: 10px;

  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .left {
      flex: 1;

      .title {
        font-size: 32px;
        font-family: PingFang SC;
        font-weight: 500;
        color: #191f25;
        line-height: 32px;

        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
      }

      .row {
        font-size: 28px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #888888;
        margin-top: 20px;
      }
    }

    .right {
      text-align: right;
      font-size: 26px;
      margin-top: 72px;

      .row {
        padding-top: 0px;
      }

      .warining {
        color: #fe9400;
      }

      .success {
        color: #4bd863;
      }
    }
  }
}

.icon {
  width: 6px;
  height: 32px;
  background: #1890ff;
  margin: 6px 10px 0 10px;
}

/deep/ .van-checkbox__icon--square {
  top: -1.6rem !important;
}
</style>
